﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project.Ycm20250401.Service
{
    public class CabinetFactory : ICabinetFactory
    {
        private readonly IServiceProvider _provider;

        public CabinetFactory(IServiceProvider provider) => _provider = provider;

        public ICabinetFunction CreateCabinet(string cabinetType) =>
            cabinetType switch
            {
                "AV1" => _provider.GetRequiredService<CabinetAV1>(),
                "BV2" => _provider.GetRequiredService<CabinetBV2>(),
                _ => throw new NotSupportedException()
            };
    }
}
